package cn.itrip.biz.service.impl;


import cn.itrip.beans.pojo.ItripAreaDic;
import cn.itrip.beans.vo.ImageVo;
import cn.itrip.beans.vo.biz.GetVideoDesc;
import cn.itrip.beans.vo.biz.ListQueryHotelCity;
import cn.itrip.beans.vo.biz.ListQueryHotelDetails;
import cn.itrip.biz.service.IItripHotelService;
import cn.itrip.dao.ItripAreaDicMapper;
import cn.itrip.dao.ItripHotelMapper;
import cn.itrip.dao.ItripLabelDicMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 酒店表 服务实现类
 * </p>
 *
 * @author 滕召伟
 * @since 2020-02-27
 */
@Service

public class ItripHotelServiceImpl implements IItripHotelService {
    @Resource
    ItripHotelMapper itripHotelMapper;
    @Resource
    ItripLabelDicMapper itripLabelDicMapper;
    @Resource
    ItripAreaDicMapper itripAreaDicMapper;

    @Override
    public List<ListQueryHotelCity> listItripHotel(Integer hotelType) {
        return itripHotelMapper.ListItripHotel(hotelType);
    }


    @Override
    public GetVideoDesc getGetVideoDescByHotelId(Integer HotelId) {
        GetVideoDesc getVideoDesc = itripHotelMapper.GetGetVideoDescByHotelId(HotelId);
        getVideoDesc.setHotelFeatureList(itripLabelDicMapper.listNameByHotelId(HotelId));
        return getVideoDesc;
    }

    @Override
    public List<ListQueryHotelDetails> ListQueryHotelDetails(Integer hotelId) {
        List<ListQueryHotelDetails> list = itripLabelDicMapper.ListQueryHotelDetails(hotelId);
        list.add(0, itripHotelMapper.ListQueryHotelDetails(hotelId));
        return list;
    }

    @Override
    public String getQueryHotelFacilities(Integer hotelId) {
        return itripHotelMapper.GetQueryHotelFacilities(hotelId);
    }

    @Override
    public String queryHotelPolicy(Integer hotelId) {
        return itripHotelMapper.QueryHotelPolicy(hotelId);
    }


    /**
     * 查询酒店图片
     *
     * @param hotelId
     * @return
     */
    @Override
    public List<ImageVo> listHotelId(Long hotelId) {
        try {
            if (hotelId != null && !"".equals(hotelId)) {
                List<ImageVo> list = itripHotelMapper.listHotelId(hotelId);
                return list;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<ItripAreaDic> QueryTradeArea(Integer cityId) {
        return itripAreaDicMapper.QueryTradeArea(cityId);
    }
}
